package com.example.netease.controller;
import com.example.netease.entity.Card;
import com.example.netease.service.CardService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;

@CrossOrigin
@Controller
@RequestMapping("/card")
public class CardController {

    @Resource
    private CardService cardService;


    @RequestMapping("/select")
    @ResponseBody
    public Card selectList(){
        Card card = cardService.select();
        return card;
    }


    @RequestMapping("/update")
    @ResponseBody
    public String edit(String cardContent,String color,String cardName,String fontColor) {
        int update = cardService.update(cardContent,color,cardName,fontColor);
        if (update>0){
            return "修改成功";
        }else{
            return "修改失败";
        }
    }
}
